<?php
require_once 'Admin/Controller/Controller.php ';
require_once 'Admin/Model/VideoModel.php';
class VideoController extends Controller{
	function __Construct(){
		parent::__Construct();	
		if(!isset($this->model)){
			$this->model = new VideoModel;
		}	
		$this->mod = 'video';
	}
	function index(){
		parent::index($this->mod);
		/*
		$data = $this->model->getList();
		$this->assign('list',$data);
		$this->view->display(); */


	}
	function form(){
		//$this->display();
		parent::form($this->mod);
	}
	function add(){
		$this->model = new VideoModel();
		$data = $_POST;
		$result = $this->model->add($data);
		if($result){
			echo '添加成功 <a href="admin.php?c=user&m=index">如果没有跳转，请点这里跳转</a>';
   			header("refresh:3;url='admin.php?c=user&m=index'");
		}
		else{
			echo "添加失败！<br/>";
  			echo "<a href='admin.php?c=user&m=userform'>返回</a>";
		}

	}
	function del(){		
		/*$id = $_GET['id'];
		$result = $this->model->del($id);
		if($result){
			echo '删除成功 <a href="admin.php?c=user&m=index">如果没有跳转，请点这里跳转</a>';
   			header("refresh:3;url='admin.php?c=user&m=index'");
		}
		else{
			echo "删除失败！<br/>";
  			echo "<a href='admin.php?c=user&m=index'>返回</a>";
		}*/
		parent::del($this->mod);
	}
	function dels(){}
	function mod(){
		$id = $_GET['id'];
		$result = $this->model->getOneByID($id);
		$this->assign('one',$result);
		$this->display(); 
	}
	function update(){
		$data = $_POST;
		$result = $this->model->update($data);
		if($result){
			echo '更新成功 <a href="admin.php?c=user&m=index">如果没有跳转，请点这里跳转</a>';
   			header("refresh:3;url='admin.php?c=user&m=index'");
		}
		else{
			echo "更新失败！<br/>";
  			echo "<a href='admin.php?c=user&m=usermod&id=".$data['id']."'>返回</a>";
		}
	}
	function search(){

	}

}
?>